package cn.gailvlun.gll.presentation.charge.model

import android.graphics.drawable.Drawable
import cn.gailvlun.gll.R
import cn.gailvlun.gll.presentation.base.App
import cn.gailvlun.gll.util.StringUtil

data class ProductModel(var productId: Int, 
                        var probabilityPoint: Int, 
                        var cash: Int, 
                        var isSelected: Boolean = false
) {
    fun getYuan(): Float {
        return cash / 100f
    }

    
    fun getSignAndYuan(): String {
        return StringUtil.format("¥{0,number,0.00}", getYuan())
    }

    fun getBG(): Drawable {
        return if (isSelected) {
            App.getInstance().resources.getDrawable(R.drawable.eight_radius_apricot)
        } else {
            App.getInstance().resources.getDrawable(R.drawable.eight_radius_silver_four_white)
        }
    }

    fun getTextColor(): Int {
        return if (isSelected) {
            App.getInstance().resources.getColor(R.color.white)
        } else {
            App.getInstance().resources.getColor(R.color.greyishBrown)
        }
    }
}